﻿@model Arms.Presentation.Web.Areas.Orders.Models.OrderModel

@{
    ViewBag.Title = "New Order";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head{
    <script>
        function onOrderTypeSelect() {
            if ($("#OrderType").val() == 2) {
                $("#pickup-date").show();
            } else {
                $("#pickup-date").hide();
            }
        }
    </script>
}
@using (Html.BeginForm())
{
    <div class="box">
        <div class="box-header">
            <div class="title">Order Type</div>
        </div>
        <div class="box-content padded">
            <div class="row">
                <div class="col-md-2">
                    @(Html.Kendo().DropDownListFor(x => x.OrderType)
                                  .DataTextField("ItemName")
                                  .DataValueField("ItemID")
                                  .Events(e => e.Select("onOrderTypeSelect"))
                                  .DataSource(ds =>
                                  {
                                      ds.Read(r => r.Action("GetOrderTypes", "Order", new { area = "Orders" }));
                                  })
                    )
                </div>
                <div id="pickup-date" class="col-md-2">
                    @(Html.Kendo().DateTimePickerFor(x => x.PickupDate).Min(DateTime.UtcNow))
                </div>
            </div>
        </div>
    </div>

    @Html.EditorFor(x => x.ProductPicker)
    @Html.Kendo().DateTimePickerFor(x => x.OrderDate).Min(DateTime.UtcNow);
    <input type="submit" value="submit" />
}